
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace BlackHtml5.WebSite.Models.Entity.Common
{
    public struct feedback:NFinal.IModel
    {
		public System.Int64 id;
		public System.String title;
		public System.String content;
		public System.String user_name;
		public System.String user_tel;
		public System.String user_qq;
		public System.String user_email;
		public System.DateTime? add_time;
		public System.String reply_content;
		public System.DateTime? reply_time;
		public System.Int16? is_lock;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator feedback(string __value__)
        {
            var __value2__ = new feedback();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(feedback __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(feedback __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out feedback par)
		{
			par=new feedback();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.title=get["title"];
						par.content=get["content"];
						par.user_name=get["user_name"];
						par.user_tel=get["user_tel"];
						par.user_qq=get["user_qq"];
						par.user_email=get["user_email"];
						par.add_time=null;
						if(get["add_time"]!=null)
						{
							par.add_time=get["add_time"].AsVar();
						}
						par.reply_content=get["reply_content"];
						par.reply_time=null;
						if(get["reply_time"]!=null)
						{
							par.reply_time=get["reply_time"].AsVar();
						}
						par.is_lock=null;
						if(get["is_lock"]!=null)
						{
							par.is_lock=get["is_lock"].AsVar();
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"title\":");
					tw.Write("\"");
					tw.Write(title==null?"null":title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"content\":");
					tw.Write("\"");
					tw.Write(content==null?"null":content);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"user_name\":");
					tw.Write("\"");
					tw.Write(user_name==null?"null":user_name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"user_tel\":");
					tw.Write("\"");
					tw.Write(user_tel==null?"null":user_tel);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"user_qq\":");
					tw.Write("\"");
					tw.Write(user_qq==null?"null":user_qq);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"user_email\":");
					tw.Write("\"");
					tw.Write(user_email==null?"null":user_email);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"add_time\":");
					tw.Write("\"");
					tw.Write(add_time==null?"null":add_time.ToString());
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"reply_content\":");
					tw.Write("\"");
					tw.Write(reply_content==null?"null":reply_content);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"reply_time\":");
					tw.Write("\"");
					tw.Write(reply_time==null?"null":reply_time.ToString());
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"is_lock\":");
					tw.Write(is_lock==null?"null" : is_lock.ToString());

			tw.Write("}");
		}
		#endregion
    }
}
